package com.greedy;

public class Solution06 {
    public int maxProfit(int[] prices) {
        int sum = 0;
        for (int i = 1; i < prices.length; i++) {
            int tmp = prices[i] - prices[i-1];
            if (tmp > 0) sum += tmp;
        }
        return sum;
    }
}
